feat: add new query types - DescribeRouteTables/DescribeSubnets/DescribeSecurityGroupRules - #11
Conversation
There was a problem hiding this comment.
Good PR. Clear motivation, and the Cloud Control failure mode is documented accurately. Build, tests and lint clean locally.
Three blockers inline: an invalid vpc-id filter pinned by a test, no must-filter guard, and the example missing from make render. Smaller notes alongside them.
Design question: registry() already maps a CRD-enum-validated queryType to a handler. Routing on a free-form parameters.operation means operation: routeTables passes admission and fails at reconcile, and duplicates the operation list in four places.
Registering DescribeRouteTables/DescribeSubnets/DescribeSecurityGroupRules directly would get schema validation for free and match the existing convention. If avoiding enum churn is the deliberate tradeoff, worth saying so in the description, and deriving the error string from the dispatch table.
9500b79 to
c658ab1
Compare
|
@ytsarev, thanks for the review. All three blockers were real and are fixed; replies inline on each thread. On the design question: taken as proposed. Your argument is stronger than the schema-validation framing suggests, given this function returns a fatal result on any error: a typo like |
|
Checked c658ab1 out locally. All eight threads addressed, seven resolved. The design change went further than I suggested: folding the shared precondition into Two things I checked specifically:
I also liked the call on absent values: documenting the two policies and explaining why omitting beats faking is a better outcome than the shape change I was angling for. Two cosmetic leftovers, neither blocking:
Nothing outstanding from my side beyond those. |
|
Both cosmetic leftovers are fixed; replies on the two threads. On the codegen drift check: confirmed independently, Gates after the rename: |
c658ab1 to
b0f89d1
Compare
ytsarev
left a comment
There was a problem hiding this comment.
Verified at b0f89d1: go build ./..., go test ./... and golangci-lint run all clean, grep -rn DescribeEc2 empty across the tree, and the CRD enum matches input.go.
Good iteration. Splitting into enum-validated query types, and folding the precondition into ec2Client with a per-operation hint, came out better than what I suggested. Same for documenting the absent-value policy instead of faking zeros.
The only thing left is the codegen drift check we discussed, which is a follow-up rather than a blocker.
Description of your changes
Why
Two identifiers can't be discovered through any existing query type:
aws_main_route_table_association- its external name is the main association ID, which onlyec2:DescribeRouteTablesreturns. TheAWS::EC2::RouteTableCloudFormation schema has justRouteTableId,Tags,VpcId.GetResourceskeeps returning deleted resources: measured 16 entries for 10 real resources, the 6 stale ones carrying the same identifying tag as their live replacements.ListResourcesis not a workaround.AWS::EC2::Subnet,AWS::EC2::SecurityGroupandAWS::EC2::SubnetRouteTableAssociationall publish nohandlerSchemaon their list handler, so Cloud Control cannot filter them server-side at all: it enumerates the type account-wide and hydrates each item, and in a shared account one foreign resource failing hydration aborts the caller's whole composition. A direct describe with a server-side filter reads only what was asked for.What
queryType: DescribeEc2, withparameters.operationselectingRouteTables,SecurityGroupRulesorSubnets. Reuses the existingtoEC2Filters, sofilterstakes native EC2 names (vpc-id,group-id).Tests
go build,go test ./...,golangci-lint run(v2.8.0, the CI pin) all clean.Verified against real EC2 in eu-central-1 (VPC + subnets + route table + associations + security group with tcp, all-protocol and group-referencing rules), then torn down.
Live runs found two defects, both fixed here:
securityGroupRuleArnwas dropped from the rule projection; realDescribeSecurityGroupRulesreturns it on every rule. Now projected.ipProtocol: -1rule omits ports. Real EC2 sends-1/-1. Fixture corrected, with a third rule keeping the genuinely-absent case covered.Live runs also confirmed
referencedGroupIdunwraps from the nestedReferencedGroupInfo, rule tags project, andsubnetIdis populated for subnet associations and empty for the main one.